﻿using Microsoft.EntityFrameworkCore;
using Prism.Ioc;
using Prism.Modularity;
using StaffModule.DbContexts;
using StaffModule.ViewModels;
using StaffModule.Views;

namespace StaffModule {
    public class StaffProfile : IModule {
        public void OnInitialized(IContainerProvider containerProvider) {

        }

        public void RegisterTypes(IContainerRegistry containerRegistry) {
            containerRegistry.RegisterForNavigation<StaffView, StaffViewModel>();

            containerRegistry.RegisterForNavigation<AddStaffView, AddStaffViewModel>();
            containerRegistry.RegisterForNavigation<UpdateStaffView, UpdateStaffViewModel>();

            containerRegistry.RegisterScoped<StaffDbContext>(provider => {
                var optionsBuilder = new DbContextOptionsBuilder<StaffDbContext>();
                optionsBuilder.UseSqlite("Data Source=D:\\Projects\\sqlite\\staff.db;");
                return new StaffDbContext(optionsBuilder.Options);
            });
        }
    }
}